<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.8.2.js"></script>
</head>
<body>
    <center>
        <form action="toFindPwdUpdate.do" method="post">
            <input type="hidden" name="cname" value="${cname!}"/>
            <table border="1" rules="all">
                <tr>
                    <td colspan="100">
                        请输入${tel!}改手机的完整手机号码
                    </td>
                </tr>
                <tr>
                    <td><input type="tel" name="tel"/></td>
                    <td>
                        <a href="#" onclick="getcode()">获取验证码</a>
                    </td>
                </tr>
                <tr  hidden id="yzm">
                    <td>验证码</td>
                    <td><input type="text" name="ycode"/></td>
                </tr>
                <tr>
                    <td colspan="12"><input type="submit" value="下一步"/>${msg!}
                    </td>
                </tr>
            </table>
        </form>
    </center>
</body>
<script>
    function getcode() {
        var tel = $("[name='tel']").val();
        var cname = $("[name='cname']").val();
        if(tel!=null){
            $.post(
                    "getFindPwdCode.do",
                    {tel:tel,cname:cname},
                    function (data) {
                        if(data=="手机号码有误"){
                            alert(data);
                        }else{
                            $("#yzm").show();
                        }
                    }
            );
        }else{
            alert("手机号码非法");
        }
    }
</script>
</html>